﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Patyk;
using Patyk.Core;

namespace Patyk.Game
{
    public static class RenderManager
    {
        private static GraphicsDeviceManager _graphics;
        private static ContentManager _content;
        private static SpriteBatch _spriteBatch;
        private static SpriteFont _spriteFont;

        public static int ScreenWidth { get; private set; }
        public static int ScreenHeight { get; private set; }

        public static void Initialise(BaseGame game)
        {
            _graphics = new GraphicsDeviceManager(game);
            game.Content.RootDirectory = "Content";
            _content = game.Content;

            ScreenWidth = 400;// Graphics.PreferredBackBufferWidth;
            ScreenHeight = 240;// Graphics.PreferredBackBufferHeight;
        }

        public static void LoadContent()
        {
            _spriteBatch = new SpriteBatch(_graphics.GraphicsDevice);
            _spriteFont = Content.Load<SpriteFont>(ConstantStrings.KootenayFont);
            //_titleSpriteFont = Content.Load<SpriteFont>(@"Fonts/TitleFont");
            //_largeSpriteFont = Content.Load<SpriteFont>(@"Fonts/LargeFont");
        }

        public static Viewport Viewport
        {
            get { return _graphics.GraphicsDevice.Viewport; }
        }

        public static GraphicsDeviceManager Graphics
        {
            get { return _graphics; }
        }

        public static GraphicsDevice Device
        {
            get { return _graphics.GraphicsDevice; }
        }
        public static ContentManager Content
        {
            get { return _content; }
        }

        public static SpriteBatch SpriteBatch
        {
            get { return _spriteBatch; }
        }

        public static SpriteFont SpriteFont
        {
            get { return _spriteFont; }
        }

        //public static SpriteFont LargeSpriteFont
        //{
        //    get { return largeSpriteFont; }
        //}

        //public static SpriteFont TitleSpriteFont
        //{
        //    get { return titleSpriteFont; }
        //}

        public static int Width
        {
            get { return _graphics.PreferredBackBufferWidth; }
        }

        public static int Height
        {
            get { return _graphics.PreferredBackBufferHeight; }
        }
    }
}